---
title: format
---

import { Badge } from "@astrojs/starlight/components";
import CheckOption from "@partials/option/check.mdx";
import ConfigOption from "@partials/option/config.mdx";
import DryRunOption from "@partials/option/dry-run.mdx";
import HelpOption from "@partials/option/help.mdx";
import LogLevelsOption from "@partials/option/log-levels.mdx";
import NoAnsiOption from "@partials/option/no-ansi.mdx";
import QuoteFilters from "@partials/tips/quote-filters.mdx";
import SourceOption from "@partials/option/source.mdx";

Sort package.json fields into a predictable order and nested fields alphabetically.

## Examples

```bash
# Fix every formatting issue in the monorepo
syncpack format
# List all formatting issues in the monorepo
syncpack format --check
# Check the formatting of one package
syncpack format --check --source 'packages/pingu/package.json'
# See more examples
syncpack format --help
# See a short summary of options
syncpack format -h
```

## Options

<QuoteFilters />

### --check

<CheckOption
  command="format"
  summary="Lint formatting instead of fixing it and exit with a status code of 1 if issues are found."
/>

### --config <Badge text="<file-path>" />

<ConfigOption command="format" />

### --dry-run

<DryRunOption command="format" />

### --log-levels <Badge text="<comma-separated-log-level-names>" />

<LogLevelsOption command="format" />

### --no-ansi

<NoAnsiOption command="format" />

### --source <Badge text="<file-pattern>" />

<SourceOption command="format" />

### --help

<HelpOption command="format" />
